package com.tianji.api.client.promotion;

import com.tianji.api.client.promotion.fallback.PromotionFallback;
import com.tianji.api.dto.promotion.CouponDiscountDTO;
import com.tianji.api.dto.promotion.OrderCouponDTO;
import com.tianji.api.dto.promotion.OrderCourseDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "promotion-service",fallbackFactory = PromotionFallback.class)
public interface  PromotionClient {
    @PostMapping("/user-coupons/available")
    List<CouponDiscountDTO> findDiscountSolution(@RequestBody List<OrderCourseDTO> orderCourses);

    @PostMapping("/user-coupons/discount")
    CouponDiscountDTO orderCouponDetail(@RequestBody OrderCouponDTO dto);

    @PutMapping("/user-coupons/use")
    void useCoupon(@RequestParam List<Long> couponIds);
    @PutMapping("/user-coupons/refund")
    void refundCoupon(@RequestParam List<Long> couponIds);

    @GetMapping("/user-coupons/rules")
    List<String> queryCouponRules(@RequestParam List<Long> couponIds);
}
